package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

class zaju {
   private Workbook a = null;
   private zoz b = null;
   private com.aspose.cells.a.f.zi c = null;
   private zajm d = null;
   private static final com.aspose.cells.b.c.a.za e = new com.aspose.cells.b.c.a.za(new String[]{"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition", "http://schemas.microsoft.com/office/2007/relationships/customDataProps", "http://schemas.microsoft.com/office/2006/relationships/attachedToolbars", "http://schemas.microsoft.com/office/2011/relationships/timelineCache", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/powerPivotData", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable", "http://schemas.microsoft.com/office/2007/relationships/ui/extensibility", "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility", "http://schemas.microsoft.com/office/2006/relationships/ui/userCustomization", "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"});

   zaju(Workbook var1, LoadOptions var2) {
      this.a = var1;
      this.b = new zoz(var1, var2);
      this.c = var1.b.b.b;
   }

   void a() throws Exception {
      if (this.b.k == 65535 || (this.b.k & 512) == 0) {
         this.j();
         this.f();
         this.k();
         this.h();
         this.i();
         this.g();
      }

      if (this.b.k == 65535) {
         this.w();
         this.m();
      }

      if ((this.b.k & 512) != 0) {
         this.p();
         this.q();
         this.r();
         if (this.b.k == 512) {
            return;
         }
      }

      if (this.b.l || this.b.k != 0) {
         this.l();
         this.s();
      }

      if (this.b.l || (this.b.k & 1) != 0) {
         this.t();
      }

      if (this.b.k == 65535) {
         this.o();
         this.v();
      }

      if (this.b.l || this.b.k != 0) {
         this.e();
         this.u();
      }

      this.a.b.a();
      this.a.getWorksheets().getExternalLinks().a(this.a.getWorksheets().v());
      this.a.getWorksheets().getNames().a(true);
      if (this.a.isDigitallySigned()) {
         this.a.i = new zrj(this.c);
      }

      if ((this.b.k & 128) != 0) {
         this.c();
      }

      if ((this.b.k & 64) != 0) {
         this.y();
         this.d();
         this.x();
         this.b();
      }

      if (this.b.k == 65535) {
         this.n();
      }

      this.a(this.a.b.i.f);
   }

   void a(ArrayList var1) throws Exception {
      Iterator var2 = this.b.b().values().iterator();
      zpd var3 = this.a.b.i;
      HashMap var4 = new HashMap();

      zqe var5;
      String var6;
      while(var2.hasNext()) {
         var5 = (zqe)var2.next();
         if (var5.j) {
            switch(e.a(var5.d)) {
            case 0:
               var6 = var5.e;
               var4.put(var6, var6);
            }
         }
      }

      var2 = this.b.b().values().iterator();

      while(var2.hasNext()) {
         var5 = (zqe)var2.next();
         int var7;
         switch(e.a(var5.d)) {
         case 0:
            var6 = var5.e;
            if (var4.get(var6) == null && !var5.j) {
               if (var6.startsWith("pivotCache/")) {
                  var6 = "xl/" + var6;
               }

               com.aspose.cells.b.a.a.ze.a(var1, (Object)var5);
               var7 = zase.aa(var6);
               if (var3.c < var7) {
                  var3.c = var7;
               }

               a(var6, (String)null, this.c, this.a);
            }
            break;
         case 1:
         case 2:
         case 3:
         case 4:
            com.aspose.cells.b.a.a.ze.a(var1, (Object)var5);
            break;
         case 5:
            var6 = var5.e;
            if (var6.startsWith("pivotTables/")) {
               var6 = "xl/" + var6;
            }

            com.aspose.cells.b.a.a.ze.a(var1, (Object)var5);
            var7 = zase.aa(var6);
            if (var3.b < var7) {
               var3.b = var7;
            }

            a(var6, (String)null, this.c, this.a);
         }
      }

   }

   private void b() {
      WorksheetCollection var1 = this.a.getWorksheets();
      Worksheet var2 = null;
      zbmw var3 = null;
      zbmt var4 = null;
      zbmu var5 = null;

      for(int var6 = 0; var6 < var1.getCount(); ++var6) {
         var2 = var1.get(var6);
         var3 = var2.d();

         for(int var7 = 0; var7 < var3.getCount(); ++var7) {
            var4 = var3.a(var7);

            for(int var8 = 0; var8 < var1.W().getCount(); ++var8) {
               var5 = var1.W().a(var8);
               if (var4.b().equals(var5.f())) {
                  var4.o = var5;
               }
            }
         }
      }

   }

   private void c() {
      for(int var1 = 0; var1 < this.a.getWorksheets().getCount(); ++var1) {
         Worksheet var2 = this.a.getWorksheets().get(var1);
         if (var2.getListObjects() != null && var2.getListObjects().getCount() > 0) {
            var2.getListObjects().e();
         }
      }

   }

   private void d() {
      for(int var1 = 0; var1 < this.a.getWorksheets().getCount(); ++var1) {
         Worksheet var2 = this.a.getWorksheets().get(var1);
         if (var2.b != null && var2.b.getCount() > 0) {
            for(int var3 = 0; var3 < var2.b.getCount(); ++var3) {
               PivotTable var4 = var2.b.get(var3);
               var4.d = this.b.a.getWorksheets().U().b(var4.aa);
               ++var4.d.o;
               if (var4.d != null && var4.d.p != null) {
                  for(int var5 = 0; var5 < var4.d.p.size(); ++var5) {
                     var4.getBaseFields().get(var5).h = (zbqs)var4.d.p.get(var5);
                  }

                  this.a(var4);
               }
            }
         }
      }

   }

   private void a(PivotTable var1) {
      for(int var2 = 0; var2 < var1.getBaseFields().getCount(); ++var2) {
         PivotField var3 = var1.getBaseFields().get(var2);
         if (var3.l() && var1.d.v != null) {
            zaur var4 = var1.d.v;

            for(int var5 = 0; var5 < var4.getCount(); ++var5) {
               zaus var6 = var4.a(var5);
               zbqw var7 = (zbqw)var6.f.e.get(0);
               if ((var7.b() & '\uffff') == var3.t) {
                  if (var3.m == 2) {
                     var7.a = 2;
                  } else if (var3.m == 4) {
                     var7.a = 4;
                  } else if (var3.m == 8) {
                     var7.a = 8;
                  }

                  var6.a(var6.a(), var6.c());
               }
            }
         }
      }

   }

   private void e() throws Exception {
      Iterator var1 = this.c.iterator();

      while(true) {
         String var3;
         String var4;
         do {
            do {
               do {
                  com.aspose.cells.a.f.zh var2;
                  do {
                     if (!var1.hasNext()) {
                        return;
                     }

                     var2 = (com.aspose.cells.a.f.zh)var1.next();
                  } while(var2.c());

                  var3 = var2.b();
                  var4 = zase.aj(var3);
               } while(var3.endsWith(".rels"));
            } while(var3.endsWith(".vml"));
         } while(!var4.equals("drawings") && !var4.equals("charts") && !var4.equals("media") && !var4.equals("customData") && !var4.endsWith("ctrlProps"));

         a(var3, var4, this.c, this.a);
      }
   }

   static zpk a(String var0, String var1, com.aspose.cells.a.f.zi var2, Workbook var3) throws Exception {
      zpk var4 = new zpk();
      var4.b = var0;
      if (var1 == null) {
         var1 = zase.aj(var0);
      }

      var4.a = var1;
      String var5 = zase.ak(var0);
      if (var2.a(var5, true) != -1) {
         zcfw var6 = zasr.a(var2, var5, true);
         var4.d = zajh.a(var6);
         var6.c();
      }

      com.aspose.cells.b.a.a.ze.a(var3.b.k, (Object)var4);
      return var4;
   }

   private void f() throws Exception {
      String var1 = "_rels/.rels";
      if (this.c.a(var1, true) != -1) {
         zcfw var2 = zasr.a(this.c, var1, true);
         HashMap var3 = zajh.b(var2);
         var2.c();
         Iterator var4 = var3.values().iterator();

         while(var4.hasNext()) {
            zqe var5 = (zqe)var4.next();
            switch(e.a(var5.d)) {
            case 6:
            case 7:
               this.a.b.n = var5.e;
               break;
            case 8:
            case 9:
               com.aspose.cells.b.a.a.ze.a(this.a.b.j, (Object)var5);
               break;
            case 10:
               this.b.g = var5.e;
            }
         }

      }
   }

   private void g() throws Exception {
      String var1 = this.b.g;
      zajw var2 = new zajw(this.b, this.c);
      zcfw var3 = zasr.a(this.c, var1, true);
      if (var3 != null) {
         var2.a(var3);
         var3.c();
      }
   }

   private void h() throws Exception {
      String var1 = this.b.g;
      zajw var2 = new zajw(this.b, this.c);
      zcfw var3 = zasr.a(this.c, var1, true);
      if (var3 != null) {
         var2.b(var3);
         var3.c();
      }
   }

   private void i() throws Exception {
      ArrayList var1 = this.b.q;
      if (var1.size() != 0) {
         for(int var2 = 0; var2 < var1.size(); ++var2) {
            zpo var3 = (zpo)var1.get(var2);
            if (var3.a.startsWith("/xl/")) {
               var3.a = var3.a.substring(4);
            }

            String var4 = "xl/" + var3.a;
            String var5 = "xl/" + com.aspose.cells.b.a.d.zk.e(var3.a) + "/_rels/" + com.aspose.cells.b.a.d.zk.b(var3.a) + ".rels";
            HashMap var6 = null;
            zcfw var7;
            if (this.c.a(var5, true) != -1) {
               var7 = zasr.a(this.c, var5, true);
               var6 = zajh.b(var7);
               var7.c();
            }

            var7 = zasr.a(this.c, var4, true);
            zajb var8 = new zajb(this.b, var6);
            var8.a(var7);
            var7.c();
         }

      }
   }

   private void j() throws Exception {
      String var1 = "[Content_Types].xml";
      zait var2 = new zait(this.b);
      zcfw var3 = zasr.a(this.c, var1, true);
      if (!var2.a(var3)) {
         throw new CellsException(4, "This file's format is not supported or you don't specify a correct format.");
      } else {
         var3.c();
      }
   }

   private void k() throws Exception {
      String var1 = this.b.g;
      int var2 = var1.lastIndexOf(47);
      if (var2 != -1) {
         var1 = var1.substring(var2 + 1);
      }

      String var3 = "xl/_rels/" + var1 + ".rels";
      zcfw var4 = zasr.a(this.c, var3, true);
      HashMap var5 = zajh.b(var4);
      this.b.a(var5);
      var4.c();
      zqe var6 = zajh.a(var5, "http://schemas.microsoft.com/office/2006/relationships/vbaProject");
      if (var6 != null) {
         String var7 = "xl/" + com.aspose.cells.b.a.d.zk.b(var6.e);
         if (this.c.a(var7, true) != -1) {
            this.a.getWorksheets().l = new VbaProject(this.a, (zane)null, var7);
         }
      }

   }

   private void l() throws Exception {
      zqe var1 = zajh.a(this.b.a(), "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme");
      if (var1 == null) {
         this.a.b.d = false;
      } else {
         String var2 = "xl/theme/" + com.aspose.cells.a.c.zt.b(var1.e);
         this.a.b.f = var2;
         if (this.c.a(var2, true) != -1) {
            this.a.b.d = true;
            com.aspose.cells.a.f.zh var3 = this.c.a(var2);
            com.aspose.cells.b.a.d.zm var4 = this.c.a(var3);
            zcfk var5 = zass.a((com.aspose.cells.b.a.d.zm)var4, (zcft)null, true);
            var4.a();
            zajr var6 = new zajr(this.b, var2);
            var6.a(var5, true);
         }

         String var9 = "xl/theme/_rels/" + com.aspose.cells.a.c.zt.b(var1.e) + ".rels";
         zcfw var10 = zasr.a(this.c, var9, true);
         if (var10 != null) {
            HashMap var11 = zajh.b(var10);
            this.a.c.d = var11;
            var10.c();
            Iterator var12 = var11.values().iterator();

            while(var12.hasNext()) {
               zqe var7 = (zqe)var12.next();
               switch(e.a(var7.d)) {
               case 11:
                  String var8 = zase.aD(var7.e);
                  var7.i = a(this.c, var8);
               }
            }
         }

      }
   }

   private void m() throws Exception {
      String var1 = this.a.b.n;
      if (var1 != null && this.c.a(var1, true) != -1) {
         zcfw var2 = zasr.a(this.c, var1, true);
         var2.j();
         if (var2.r() != 0) {
            this.a.setRibbonXml(var2.u());
         }

         var2.c();
      }

   }

   private void n() throws Exception {
      zcfw var1 = null;
      String var2 = this.b.m;
      String var3 = this.b.n;
      if (var2 != null) {
         zazw var4 = this.a.getWorksheets().af();
         if (this.c.a(var2, false) != -1) {
            var1 = zasr.a(this.c, var2, true);
            zaji var5 = new zaji(var4);
            var5.a(var1);
         }

         if (this.c.a(var3, false) != -1) {
            var1 = zasr.a(this.c, var3, true);
            zajk var11 = new zajk(var4);
            var11.a(var1);
         }

         HashMap var12 = null;
         String var6 = "xl/revisions/_rels/" + com.aspose.cells.b.a.d.zk.b(var2) + ".rels";
         if (this.c.a(var6, false) != -1) {
            var1 = zasr.a(this.c, var6, true);
            var12 = zajh.b(var1);
            var1.c();
         }

         zajj var7 = new zajj(this.b);

         for(int var8 = 0; var8 < var4.getCount(); ++var8) {
            zazv var9 = var4.a(var8);
            if (var9.b.i != null && !"".equals(var9.b.i)) {
               zqe var10 = (zqe)var12.get(var9.b.i);
               var1 = zasr.a(this.c, "xl/revisions/" + var10.e, true);
               var7.a(var1, var9);
               var1.c();
            }
         }

      }
   }

   private void o() throws Exception {
      String var1 = "xl/xmlMaps.xml";
      if (this.c.a(var1, true) != -1) {
         zakb var2 = new zakb(this.b);
         zcfw var3 = zasr.a(this.c, var1, true);
         var2.a(var3);
         var3.c();
      }

   }

   private void p() throws Exception {
      String var1 = "docProps/core.xml";
      if (this.c.a(var1, true) != -1) {
         zaix var2 = new zaix(this.b);
         zcfw var3 = zasr.a(this.c, var1, true);
         var2.a(var3);
         var3.c();
      }

   }

   private void q() throws Exception {
      String var1 = "docProps/app.xml";
      if (this.c.a(var1, true) != -1) {
         zaiw var2 = new zaiw(this.b);
         zcfw var3 = zasr.a(this.c, var1, true);
         var2.a(var3);
         var3.c();
      }

   }

   private void r() throws Exception {
      String var1 = "docProps/custom.xml";
      if (this.c.a(var1, true) != -1) {
         zaiy var2 = new zaiy(this.b);
         zcfw var3 = zasr.a(this.c, var1, true);
         var2.a(var3);
         var3.c();
      }

   }

   private void s() throws Exception {
      String var1 = "xl/styles.xml";
      if (this.c.a(var1, true) != -1) {
         zajp var2 = new zajp(this.b);
         zcfw var3 = zasr.a(this.c, var1, true);
         var2.a(var3);
         var3.c();
         var3 = zasr.a(this.c, var1, true);
         var2.b(var3);
         var3.c();
      }

   }

   private void t() throws Exception {
      String var1 = this.b.o;
      if (var1 == null) {
         var1 = "xl/sharedStrings.xml";
      } else if (var1.startsWith("/")) {
         var1 = var1.substring(1);
      }

      if (this.c.a(var1, true) != -1) {
         this.d = new zajm(this.b);
         zcfw var2 = zasr.a(this.c, var1, true);
         this.d.a(var2);
         var2.c();
      }

   }

   private void u() throws Exception {
      if (this.d == null) {
         this.d = new zajm(this.b);
      }

      HashMap var1 = this.b.a();
      Iterator var2 = this.b.c.iterator();

      zpa var3;
      zqe var4;
      String var5;
      while(var2.hasNext()) {
         var3 = (zpa)var2.next();
         if (var3.c != null && !"".equals(var3.c)) {
            var4 = (zqe)var1.get(var3.c);
            var5 = com.aspose.cells.b.a.d.zk.b(var4.e);
            if (var4.e.indexOf("worksheets/") != -1) {
               this.a(var3, var5);
            }
         }
      }

      var2 = this.b.c.iterator();

      while(var2.hasNext()) {
         var3 = (zpa)var2.next();
         if (var3.c != null && !"".equals(var3.c)) {
            var4 = (zqe)var1.get(var3.c);
            var5 = com.aspose.cells.b.a.d.zk.b(var4.e);
            if (var4.e.indexOf("worksheets/") != -1) {
               this.b(var3, var5);
            } else if (var4.e.indexOf("chartsheets/") != -1 && zase.b) {
               this.c(var3, var5);
            }
         }
      }

   }

   private void a(zpa var1, String var2) throws Exception {
      this.a(var1, 1, var2);
      this.a(var1);
      this.c(var1);
   }

   private void a(zpa var1) throws Exception {
      ArrayList var2 = zajh.c(var1.e, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable");

      for(int var3 = 0; var3 < var2.size(); ++var3) {
         zqe var4 = (zqe)var2.get(var3);
         String var5 = "xl/queryTables/" + com.aspose.cells.b.a.d.zk.b(var4.e);
         if (this.c.a(var5, true) != -1) {
            com.aspose.cells.a.f.zh var6 = this.c.a(var5);
            com.aspose.cells.b.a.d.zm var7 = this.c.a(var6);
            zcfk var8 = zass.a((com.aspose.cells.b.a.d.zm)var7, (zcft)null, true);
            var7.a();
            zajg var9 = new zajg(var1, var5);
            var9.a(var8);
         }
      }

   }

   private void b(zpa var1, String var2) throws Exception {
      this.a.l();
      this.g(var1);
      this.a.l();
      this.i(var1);
      this.a.l();
      this.d(var1, var2);
      this.h(var1);
      this.a.l();
      zkx var3 = null;
      zahs var4 = null;
      String var5 = var1.a(var1.h);
      Cells var6;
      if (var5 != null) {
         var6 = var1.d.getCells();
         var3 = new zkx(var6, 16383);
         var6.c = var3;
         var6.getRows().b(0);
         var4 = var6.getRows().b;
         this.g(var1, var5);
      }

      this.a.l();
      var5 = var1.a(var1.f);
      if (var5 != null) {
         if (var3 == null) {
            var6 = var1.d.getCells();
            var3 = new zkx(var6, 16383);
            var6.c = var3;
            var6.getRows().b(0);
            var4 = var6.getRows().b;
         }

         this.e(var1, var5);
      }

      if (var3 != null) {
         var6 = var1.d.getCells();
         var6.l();
         var6.getRows().b();
      }

      if (var1.g != null) {
         this.f(var1);
      }

      if (var1.i != null) {
         this.e(var1);
      }

      this.b(var1);
      if (var1.k != null) {
         this.d(var1);
      }

      String var9 = var1.b();
      if (var9 != null) {
         var9 = zase.aD(var9);
         com.aspose.cells.a.f.zh var7 = this.c.a(var9);
         com.aspose.cells.b.a.d.zm var8 = this.c.a(var7);
         var1.d.g.h = com.aspose.cells.a.c.zw.a(var8, false);
         var8.a();
      }

      zavb.a(var1.d, true);
   }

   private void b(zpa var1) throws Exception {
      if (var1.j != null) {
         String var2 = var1.a(var1.j);
         if (var2 != null) {
            String var3 = zase.aD(var2);
            com.aspose.cells.a.f.zh var4 = this.c.a(var3);
            com.aspose.cells.b.a.d.zm var5 = this.c.a(var4);
            byte[] var6 = com.aspose.cells.a.c.zw.a(var5, false);
            var5.a();
            if (var1.d.getType() == 2) {
               var1.d.getCharts().get(0).getPageSetup().a(var6);
            } else {
               var1.d.getPageSetup().a(var6);
            }
         }
      }

      if (var1.d.n != null && var1.d.n.getCount() > 0) {
         for(int var9 = 0; var9 < var1.d.n.getCount(); ++var9) {
            znb var10 = var1.d.n.a(var9);
            if (var10.b != null) {
               String var11 = var1.a(var10.b);
               if (var11 != null) {
                  String var12 = zase.aD(var11);
                  com.aspose.cells.a.f.zh var13 = this.c.a(var12);
                  com.aspose.cells.b.a.d.zm var7 = this.c.a(var13);
                  byte[] var8 = com.aspose.cells.a.c.zw.a(var7, false);
                  var7.a();
                  var10.e().a(var8);
                  var10.b = null;
               }
            }
         }
      }

   }

   private void c(zpa var1) throws Exception {
      ArrayList var2 = zajh.c(var1.e, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table");

      for(int var3 = 0; var3 < var2.size(); ++var3) {
         zqe var4 = (zqe)var2.get(var3);
         String var5 = "xl/tables/" + com.aspose.cells.b.a.d.zk.b(var4.e);
         zcfw var6 = zasr.a(this.c, var5, true);
         zajq var7 = new zajq(var1);
         var7.a(var6);
         var6.c();
         String var8 = "xl/tables/_rels/" + com.aspose.cells.b.a.d.zk.b(var4.e) + ".rels";
         if (this.c.a(var8, false) != -1) {
            var6 = zasr.a(this.c, var8, true);
            var7.a().a = zajh.b(var6);
            var6.c();
         }
      }

   }

   private void d(zpa var1) throws Exception {
      com.aspose.cells.b.a.a.zc var2 = com.aspose.cells.b.a.a.zf.a(var1.k);

      while(var2.c()) {
         String var3 = (String)var2.a();
         String var4 = (String)var2.b();
         String var5 = var1.a(var4);
         if (var5 != null) {
            var5 = zase.aD(var5);
            com.aspose.cells.a.f.zh var6 = this.c.a(var5);
            com.aspose.cells.b.a.d.zm var7 = this.c.a(var6);
            byte[] var8 = new byte[(int)var6.a()];
            var7.a(var8, 0, (int)var6.a());
            var7.a();
            String var9 = Encoding.getUnicode().a(var8);
            var1.d.getCustomProperties().add(var3, var9);
         }
      }

   }

   private void e(zpa var1) throws Exception {
      String var2 = zase.aD(var1.a(var1.i));
      com.aspose.cells.a.f.zh var3 = this.c.a(var2);
      com.aspose.cells.b.a.d.zm var4 = this.c.a(var3);
      byte[] var5 = new byte[(int)var3.a()];
      var4.a(var5, 0, (int)var3.a());
      var4.a();
      var1.d.setBackground(var5);
      com.aspose.cells.b.a.a.ze.a(this.a.b.h, (Object)com.aspose.cells.b.a.d.zk.b(var2));
   }

   private void f(zpa var1) throws Exception {
      String var2 = var1.a(var1.g);
      if (var2 != null) {
         var2 = zase.aD(var2);
         zcfw var3 = zasr.a(this.c, var2, true);
         zajc var4 = new zajc();
         ArrayList var5 = var4.a(var3);
         var3.c();
         String var6 = "xl/drawings/_rels/" + com.aspose.cells.b.a.d.zk.b(var2) + ".rels";
         if (var5 == null) {
            return;
         }

         if (this.c.a(var6, true) == -1) {
            return;
         }

         var3 = zasr.a(this.c, var6, true);
         HashMap var7 = zajh.b(var3);
         var3.c();
         if (var7 == null || var7.size() == 0) {
            throw new CellsException(6, var6 + " does not exist or is empty");
         }

         for(int var8 = 0; var8 < var5.size(); ++var8) {
            zou var9 = (zou)var5.get(var8);
            if (var9.a != null) {
               if (!var7.containsKey(var9.a)) {
                  throw new CellsException(6, var6 + " does not contains relId " + var9.a);
               }

               zqe var10 = (zqe)var7.get(var9.a);
               String var11 = zase.aD(var10.e);
               com.aspose.cells.a.f.zh var12 = this.c.a(var11);
               com.aspose.cells.b.a.d.zm var13 = this.c.a(var12);
               byte[] var14 = new byte[(int)var12.a()];
               var13.a(var14, 0, (int)var12.a());
               var13.a();
               Picture var15 = var1.d.getPageSetup().a(var9.a(), var14);
               var9.a(var15, this.a.getWorksheets().L());
               com.aspose.cells.b.a.a.ze.a(this.a.b.h, (Object)com.aspose.cells.b.a.d.zk.b(var11));
            }
         }
      }

   }

   private void c(zpa var1, String var2) throws Exception {
      this.a(var1, 2, var2);
      this.a.l();
      this.f(var1, var2);
      this.a.l();
      String var3 = var1.a(var1.h);
      if (var3 != null) {
         this.g(var1, var3);
      }

      this.a.l();
      var3 = var1.a(var1.f);
      if (var3 != null) {
         this.e(var1, var3);
      }

      if (var1.g != null) {
         this.f(var1);
      }

      if (var1.i != null) {
         this.e(var1);
      }

      if (var1.j != null) {
         this.b(var1);
      }

   }

   private void d(zpa var1, String var2) throws Exception {
      String var3 = "xl/worksheets/" + var2;
      zajy var4 = new zajy(this.b, var1);
      zcfw var5 = zasr.a(this.c, var3, true);
      var4.a(this.d);
      var4.a(var5);
      var5.c();
      var1.d.g.b = var3;
   }

   private void a(zpa var1, int var2, String var3) throws Exception {
      String var4 = null;
      if (var2 == 1) {
         var4 = "xl/worksheets/_rels/" + var3 + ".rels";
      } else {
         if (var2 != 2) {
            throw new CellsException(16, "Cells Internal error, unsupported sheet type");
         }

         var4 = "xl/chartsheets/_rels/" + var3 + ".rels";
      }

      if (this.c.a(var4, true) != -1) {
         zcfw var5 = zasr.a(this.c, var4, true);
         var1.e = zajh.b(var5);
         var5.c();
         var1.a(var1.d.g.j);
      }

   }

   private void v() throws Exception {
      zqe var1 = zajh.a(this.b.a(), "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections");
      if (var1 != null) {
         String var2 = "xl/" + com.aspose.cells.b.a.d.zk.b(var1.e);
         if (this.c.a(var2, true) != -1) {
            com.aspose.cells.a.f.zh var3 = this.c.a(var2);
            com.aspose.cells.b.a.d.zm var4 = this.c.a(var3);
            zcfk var5 = zass.a((com.aspose.cells.b.a.d.zm)var4, (zcft)null, true);
            var4.a();
            zais var6 = new zais(this.b, var2);
            var6.a(var5);
         }

      }
   }

   static byte[] a(com.aspose.cells.a.f.zi var0, String var1) throws Exception {
      com.aspose.cells.a.f.zh var2 = var0.a(var1);
      if (var2 == null) {
         return null;
      } else {
         com.aspose.cells.b.a.d.zm var3 = var0.a(var2);
         byte[] var4 = new byte[(int)var2.a()];
         var3.a(var4, 0, (int)var2.a());
         var3.a();
         return var4;
      }
   }

   private void w() throws Exception {
      HashMap var1 = this.b.a();
      Iterator var2 = var1.values().iterator();
      com.aspose.cells.b.a.a.zd var3 = new com.aspose.cells.b.a.a.zd();

      while(var2.hasNext()) {
         zqe var4 = (zqe)var2.next();
         if (var4.d != null && var4.d.equals("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml")) {
            String var5 = var4.e;
            if (var5.startsWith("../")) {
               var5 = var5.substring(3);
            } else if (var5.startsWith("/")) {
               var5 = var5.substring(1);
            }

            String var6 = com.aspose.cells.a.c.zt.b(var5);
            int var7 = var6.lastIndexOf(".");
            var7 = zase.C(var6.substring(4, 4 + (var7 - 4))) - 1;
            if (!var3.b((Object)var7)) {
               var3.a(var7, var5);
            }
         }
      }

      var2 = var3.f().iterator();

      while(true) {
         byte[] var15;
         byte[] var16;
         do {
            if (!var2.hasNext()) {
               return;
            }

            String var14 = (String)var2.next();
            var15 = a(this.c, var14);
            var16 = null;
            String var17 = com.aspose.cells.a.c.zt.b(var14);
            String var8 = var14.substring(0, 0 + (var14.length() - var17.length()));
            String var9 = var8 + "_rels/" + var17 + ".rels";
            zcfw var10 = zasr.a(this.c, var9, true);
            if (var10 != null) {
               ArrayList var11 = zajh.a(var10);
               Iterator var12 = var11.iterator();

               while(var12.hasNext()) {
                  zqe var13 = (zqe)var12.next();
                  if (var13.d.equals("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps")) {
                     var16 = a(this.c, var8 + var13.e);
                     break;
                  }
               }
            }
         } while(var15 == null && var16 == null);

         this.a.m().a(var15, var16);
      }
   }

   private void x() throws Exception {
      ArrayList var1 = this.b.p;
      if (var1 != null) {
         for(int var2 = 0; var2 < var1.size(); ++var2) {
            zqe var3 = (zqe)var1.get(var2);
            String var4 = com.aspose.cells.a.c.zt.b(var3.e);
            zajo var5 = new zajo(this.b, var4, var3.a);
            String var6 = "xl/slicerCaches/" + var4;
            zcfw var7 = zasr.a(this.c, var6, true);
            if (null != var7) {
               var5.a(var7);
               var7.c();
            }
         }

      }
   }

   private void y() throws Exception {
      HashMap var1 = this.b.a();
      zaul var2 = this.b.a.getWorksheets().U();
      ArrayList var3 = this.b.h;

      for(int var4 = 0; var4 < var3.size(); ++var4) {
         zqc var5 = (zqc)var3.get(var4);
         if (!var1.containsKey(var5.e)) {
            throw new CellsException(6, "pivotCache rid " + var5.e + " not found in workbook rels file");
         }

         zqe var6 = (zqe)var1.get(var5.e);
         var6.j = true;
         String var7 = com.aspose.cells.b.a.d.zk.b(var6.e);
         zajd var8 = new zajd(this.b, var6.e, var5.c, this.c, var7);
         HashMap var9 = this.a(var7);
         String var10 = "xl/pivotCache/" + var7;
         zcfw var11 = zasr.a(this.c, var10, true);
         var8.a(var11);
         var8.a().C = var9;
         var8.b();
      }

   }

   private HashMap a(String var1) throws Exception {
      String var2 = "xl/pivotCache/_rels/" + var1 + ".rels";
      if (this.c.a(var2, true) != -1) {
         zcfw var3 = zasr.a(this.c, var2, true);
         HashMap var4 = zajh.b(var3);
         this.b.b(var4);
         var3.c();
      } else {
         this.b.b((HashMap)null);
      }

      return this.b.c();
   }

   private void g(zpa var1) throws Exception {
      if (var1.e != null && var1.e.size() != 0) {
         var1.d.b = new PivotTableCollection(var1.d);
         ArrayList var2 = zajh.c(var1.e, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable");

         for(int var3 = 0; var3 < var2.size(); ++var3) {
            zqe var4 = (zqe)var2.get(var3);
            String var5 = "xl/pivotTables/" + com.aspose.cells.b.a.d.zk.b(var4.e);
            zcfw var6 = zasr.a(this.c, var5, true);
            if (var6 != null) {
               zajf var7 = new zajf(this.b, var1, var4.e);
               var7.a(var6);
               var6.c();
            }
         }

      }
   }

   private void h(zpa var1) throws Exception {
      if (var1.l != null && var1.l.size() != 0) {
         ArrayList var2 = var1.l;

         for(int var3 = 0; var3 < var2.size(); ++var3) {
            zqe var4 = (zqe)var2.get(var3);
            String var5 = "xl/slicers/" + com.aspose.cells.b.a.d.zk.b(var4.e);
            zcfw var6 = zasr.a(this.c, var5, true);
            if (null != var6) {
               zajn var7 = new zajn(this.b, var1, var4.e, var4.a);
               var7.a(var6);
               var6.c();
            }
         }

      }
   }

   private void e(zpa var1, String var2) throws Exception {
      zcfw var3 = null;
      String var4 = "xl/drawings/_rels/" + com.aspose.cells.b.a.d.zk.b(var2) + ".rels";
      var2 = zase.aD(var2);
      HashMap var5 = null;
      if (this.c.a(var4, true) != -1) {
         var3 = zasr.a(this.c, var4, true);
         var5 = zajh.b(var3);
         var3.c();
      }

      zajs var6 = new zajs(var1, var5, this.c, var2);
      var6.a();
      var1.d.g.q = var6.b();
      this.a.b.a(var2);
   }

   private void i(zpa var1) throws Exception {
      String var2 = var1.a();
      if (var2 != null) {
         zcfw var3 = zasr.a(this.c, var2, true);
         zair var4 = new zair(this.b, var1);
         var4.a(var3);
         var3.c();
      }

   }

   private void f(zpa var1, String var2) throws Exception {
      String var3 = "xl/chartsheets/" + var2;
      zaip var4 = new zaip(this.b, var1);
      zcfw var5 = zasr.a(this.c, var3, true);
      var4.a(var5);
      var5.c();
      var1.d.g.b = var3;
   }

   private void g(zpa var1, String var2) throws Exception {
      zcfw var3 = null;
      String var4 = "xl/drawings/_rels/" + com.aspose.cells.b.a.d.zk.b(var2) + ".rels";
      var2 = zase.aD(var2);
      HashMap var5 = null;
      if (this.c.a(var4, false) != -1) {
         var3 = zasr.a(this.c, var4, true);
         var5 = zajh.a(var3, this.b, this.a, this.c);
         var3.c();
      }

      zaiz var6 = new zaiz(var1, var5, this.c, var2);
      var6.a();
      if (var6.b().size() > 0) {
         var1.d.t().a(var6.b());
      }

      this.a.b.a(var2);
   }

   static Shape a(Shape var0) throws Exception {
      com.aspose.cells.a.f.zi var1 = null;
      Workbook var2 = var0.L().n();
      if (var2.b != null && var2.b.b != null) {
         var1 = var2.b.b.b;
         String var3 = var0.o;
         zcfw var4 = null;
         String var5 = "xl/diagrams/_rels/" + com.aspose.cells.b.a.d.zk.b(var3) + ".rels";
         var3 = zase.aD(var3);
         if (var1.a(var3, false) == -1) {
            return null;
         } else {
            HashMap var6 = null;
            if (var1.a(var5, false) != -1) {
               var4 = zasr.a(var1, var5, true);
               var6 = zajh.a(var4, (zoz)null, var2, var1);
               var4.c();
            }

            Worksheet var7 = var0.M();
            zoz var8 = new zoz(var2);
            zpa var9 = new zpa(var8, var7);
            zaiz var10 = new zaiz(var9, var6, var1, var3);
            ShapeCollection var11 = new ShapeCollection(var7.c(), var7, new zra(var7.c(), 0), var7, -1);
            var10.b = var11;
            Shape var12 = var10.a(var0);
            return var12;
         }
      } else {
         return null;
      }
   }
}
